import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main3 {
    static int res = 0;

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        int n = in.nextInt();

        int[] startTime = new int[n];
        for (int i = 0; i < n; i++) {
            startTime[i] = in.nextInt();
        }

        int[] lastTime = new int[n];
        for (int i = 0; i < n; i++) {
            lastTime[i] = in.nextInt();
        }

        int[] profit = new int[n];
        for (int i = 0; i < n; i++) {
            profit[i] = in.nextInt();
        }
        // 简化为回溯问题
        backTrace(startTime, profit, lastTime, n, 0, 0, 0);
        System.out.println(res);
    }

    private static void backTrace(int[] startTime, int[] profit, int[] lastTime, int n, int curSum, int curTime, int index) {
        if (index >= n) {
            res = Math.max(res, curSum);
            return;
        }

        for (int i = index; i < n; i++) {
            if (startTime[i] >= curTime) {
                backTrace(startTime, profit, lastTime, n, curSum + profit[i], curTime + lastTime[i], i+1);
            }
        }
    }
}